<?php
include('function/connection.php'); 
include('function/function.php');

$sql="SELECT * FROM tbl_products  WHERE pd_name='".$_POST['stock_name']."'";
$result=mysql_query($sql);
$row=mysql_fetch_assoc($result);
$buying_rate=$row['buying_price'];
$rate=$row['selling_price'];
if($rate!=NULL)
{
	$sql="SELECT * FROM tbl_stocks_available  WHERE pd_name='".$_POST['stock_name']."'";
	$result=mysql_query($sql);
	$row=mysql_fetch_assoc($result);
	$availstock=$row['qty'];
	$arr = array ("rate"=>"$rate","availstock"=>"$availstock","brate"=>"$buying_rate");
	echo json_encode($arr);
}
else
{
	$arr1 = array ("no"=>"no");
	echo json_encode($arr1);

}
?>